%file: readDisplayData.m
%date: 041604
%action: read a raw file, convert in into an (width, height) image and display the image
%

function ourImage2=readDisplayData(filename, width, height)

%open the raw data file
fileData=fopen(filename, 'r');

%read the imange
[matrix1D,count]=fread(fileData);

%define one matrix of needed dimensions
ourImage1=[width, height];

%convert 1D data matrinx into a 2D matrix
for r=1:height
    for c=1:width
        ourImage1(r,c)=matrix1D((r-1)*width+c);
    end
end

ourImage2=flipud(ourImage1);
%display the flipped matrix using graylevels
figure;
colormap(gray(256));
image(ourImage2);
title('the initial image');

